#version 400 core

#define PARTICLE_POSITION   0
#define PARTICLE_VEL		1
#define PARTICLE_COLOR      2
#define PARTICLE_PROP       3
#define FRAG_COLOR			0

layout(location = FRAG_COLOR) out vec4 COLOR_OUT;

in vec4 fColor;
flat in vec4 fProps;

void main()
{
    COLOR_OUT = vec4(fColor.rgb, fColor.a);
    float psd = length(vec2(0.5, 0.5) - gl_PointCoord.st)*1.41; // zero for centre, 1 for corners
    psd *= 1.5;
    psd = clamp(psd, 0.0, 1.0);
    COLOR_OUT.a = mix(COLOR_OUT.a, 0.0, psd);

    COLOR_OUT.a *= fProps.y; // fProps.y prenormalized in VS
}
